package com.techthinker.dreamBuilder.Database;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;

import com.techthinker.dreamBuilder.Define.Constant;

public class DatabaseHelper extends SQLiteOpenHelper {

	public DatabaseHelper(Context context, String name, CursorFactory factory,int version) {
		super(context, name, factory, version);
	}
	public DatabaseHelper(Context context,String name,int version){
		this(context, name,null,version);
	}
	public DatabaseHelper(Context context,String name){
		this(context,name,Constant.DB_VERSION);
	}

	//initiate database
	@Override
	public void onCreate(SQLiteDatabase db) {
		//create all tables
		db.execSQL(Constant.SQL_CREATE_DICTIONARY);
		db.execSQL(Constant.SQL_CREATE_LIST);
		db.execSQL(Constant.SQL_CREATE_BOOKMARK);
		db.execSQL(Constant.SQL_CREATE_TASK);
		db.execSQL(Constant.SQL_CREATE_TRACE);
		db.execSQL(Constant.SQL_CREATE_TEST);
		db.execSQL(Constant.SQL_CREATE_TESTDETAIL);
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
	}

}
